package chances.system.operator.repo;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import chances.system.operator.entity.Operator;

public interface OperatorRepository extends JpaRepository<Operator,Long>{
	public Operator getByLoginName(@Param("loginName")String name);
	public Operator getByEmail(String name);
	public List<Operator> findByLoginName(@Param("loginName")String name);
	
	@Query("select o from Operator o where o.loginName like %:loginName%") 
	public List<Operator> findByLoginNameLike(@Param("loginName")String name);
	
	@Query("select o from Operator o") 
	public Page<Operator> search(@Param("loginName")String loginName, Pageable pageable);
}
